<!DOCTYPE html>
<html lang="zh" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,minimum-scale=1.0, maximum-scale=1.0, user-scalable=no,viewport-fit=cover">
    <meta name="format-detection" content="telephone=no">
    <meta http-equiv="x-rim-auto-match" content="none">
    <link rel="stylesheet" href="/addons/jquery-weui-build/css/weui.min.css">
    <link rel="stylesheet" href="/addons/jquery-weui-build/css/jquery-weui.css">
    <link rel="stylesheet" href="/css/system/iconfont.css">
    <link rel="stylesheet" href="/css/system/front-iconfont.css">
    <link rel="stylesheet" href="/css/system/common.css">
    @if($skinid == 3)
        <link rel="stylesheet" href="/css/login/index.css?v={{time()}}">
    @elseif($skinid == 1)
        <link rel="stylesheet" href="/css/theme-blue/login/index.css?v={{time()}}">
    @endif
    <script src="/js/jquery-2.1.4.min.js"></script>
    <title>登录</title>
</head>
<body ontouchstart>
<div class="login-bk">
    <div class="login-title">
        @if($skinid == 2)
            <img src="/img/kpi.png">
        @elseif($skinid == 1)
            <img src="/img-theme-blue/kpi.png">
        @endif
        <p>绩效考核系统</p>
    </div>
    <form class="weui-cells login-form" action="" method="post" onsubmit="return false;">
        <div class="weui-cell cell-name">
            <div class="weui-cell__hd"><i class="icon iconfont icon-yonghu"></i></div>
            <div class="weui-cell__bd">
                <input type="text" id="username" name="username" class="input-text" placeholder="" />
            </div>
        </div>
        <div class="weui-cell cell-pass">
            <div class="weui-cell__hd"><i class="icon iconfont icon-mima"></i></div>
            <div class="weui-cell__bd">
                <input type="password" id="password" name="password" class="input-text" placeholder="" />
            </div>
        </div>
        <button type="submit" class="weui-btn weui-btn_color login-btn"/>登录</button>
        <div class="weui-cell hidden-bk">
            <div class="weui-cell__hd"><input style="vertical-align:middle" type="checkbox" name="remember" class="ace" id="remember"/><span class="lbl"> 记住我</span></div>
            <div class="weui-cell__bd"><a href="/front/register">注册</a></div>
        </div>
        <a href="/front/find-password">找回密码</a>
        {!! csrf_field() !!}
    </form>
</div>
<script src="/addons/jquery-weui-build/js/fastclick.js"></script>
<script src="/addons/jquery-weui-build/js/jquery-weui.min.js"></script>
<script>
    $(function() {
        document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + 'px';
        FastClick.attach(document.body);
    });
</script>
<script>
    $(document).ready(function () {
        var token = $('input[name=_token]').val();
        $('.login-btn').click(function () {
            $('.login-btn').attr('disabled','disabled');
            setInterval(function(){
                $('.login-btn').attr('disabled',false);
            },3000);
            var username = $("#username").val().trim();
            var password = $("#password").val().trim();
            var remember = $("#remember").is(":checked");
            if(username==''){
                $.toast("请输入用户名!",'text');
                return false;
            }
            if(password == ""){
                $.toast("请输入密码!",'text');
                return false;
            }
            $.ajax({
                'url': '/front/login?_token='+token,
                'type': 'POST',
                'data': 'username='+username+'&password='+password+'&is_remember='+remember,
                'dataType': "json",
                error: function (request) {
                    $.toast('网络错误',"text");
                },
                success: function (data) {
                    if (data.status == 'success') {
                        $.toast(data.msg);
                        setTimeout(function(){ window.location.href=data.redirectUrl; }, 1000);
                    } else {
                        $.toast(data.msg,"text");
                    }
                },
            });
        })
    })
</script>
</body>
</html>
